package com.menhai.personmanagement.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.menhai.personmanagement.entity.HtEquipment;
import com.menhai.personmanagement.services.IHtEquipmentService;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lion
 * @since 2023-04-19
 */

@Slf4j
@RestController
@RequestMapping("/equipment")
public class HtEquipmentController {

     @Autowired
     private IHtEquipmentService htEquipmentService;

     @RequestMapping("/selectAll")
     public Page<HtEquipment> selectAll(@Param("pagesize") int pagesize, @Param("size") int size){
          return htEquipmentService.selectAll(pagesize, size);
     }
     @RequestMapping("/selectByMacOrSn")
     public Page<HtEquipment> selectByMacOrSn(@Param("content") String content, @Param("pagesize") int pagesize, @Param("size") int size){
          return htEquipmentService.findEquipmentByMacOrSn(content,pagesize, size);
     }
     @RequestMapping("/addEquipment")
     public int addEquipment(HtEquipment htEquipment){
          return htEquipmentService.addEquipment(htEquipment);
     }

     @RequestMapping("/editEquipment")
     public int editRole(HtEquipment htEquipment){
          int temp = htEquipmentService.editEquipment(htEquipment);
          return temp;
     }

     @RequestMapping("/delEquipment")
     public int delRole(@Param("id") String id){
          return htEquipmentService.delEquipment(id);
     }
}
